package cq.zhcqk.fragment._3_zw;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.loopj.android.http.AsyncHttpClient;

import cq.zhcqk.R;
import cq.zhcqk.activity.AXYZ_ListActivity;
import cq.zhcqk.activity.ZW_ListActivity;

/**
 * Created by zhangle on 2017/12/10.
 */
public class _3_MsbzFragment extends Fragment implements View.OnClickListener{
    private View view;
    private Context context;
    private AsyncHttpClient httpClient;
    private TextView zhiwen;
    private TextView dibao;
    private TextView qiuzhu;
    private TextView aixin;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if(view==null){
            view = inflater.inflate(R.layout.fragment_5_1_dg, container, false);
            context = getActivity();
            initView();
        }
        ViewGroup parent=(ViewGroup)view.getParent();
        if(parent!=null){
            parent.removeView(view);
        }
        return view;
    }

    private void initView(){
        zhiwen = (TextView) view.findViewById(R.id.zhiwen);
        dibao = (TextView) view.findViewById(R.id.dibao);
        qiuzhu = (TextView) view.findViewById(R.id.kunan);
        aixin = (TextView) view.findViewById(R.id.aixin);

        zhiwen.setOnClickListener(this);
        dibao.setOnClickListener(this);
        qiuzhu.setOnClickListener(this);
        aixin.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.zhiwen:
                intent = new Intent(context,ZW_ListActivity.class);
                intent.putExtra("type","22");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.dibao:
                intent = new Intent(context,ZW_ListActivity.class);
                intent.putExtra("type","23");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.kunan:
                intent = new Intent(context,ZW_ListActivity.class);
                intent.putExtra("type","24");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
            case R.id.aixin:
                intent = new Intent(context,AXYZ_ListActivity.class);
                intent.putExtra("type","15");
                startActivity(intent);
                getActivity().overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
                break;
        }
    }
}
